<?php
 header("content-Type:text/html;charset=utf-8");
  $con = mysqli_connect("127.0.0.1","root","123456");
  $db=mysqli_select_db($con,"my_db");
 $id = $_POST['id'];
 if($id){
     $sql="select * from persons where id = $id;";
     $result = mysqli_query($con,$sql);
     if($result&&mysqli_num_rows($result)>0)
     {
         $shop=mysqli_fetch_assoc($result);//解析出要修改的商品信息
         if($shop["password"]==$_POST["password"]){
             header("Location:self.php");
         }
         else{
             header("Location:登录.html");
         }
     } else
     {
         header("Location:登录.html");
     }
 }
 else{
     $sql1="insert into persons (id,password) values({$_POST["name"]},{$_POST["inputPass"]})";
     mysqli_query($con,$sql1);
     header("Location:success.html");
 }
?>


